package com.superbytecode.cloud.rocketmq.consumer;

import com.superbytecode.cloud.common.context.SpringContextUtil;
import com.superbytecode.cloud.rocketmq.configure.MQProviderEnum;

/**
 * All rights Reserved, Designed By www.super-master.com
 *
 * @ProjectName: beacon-cloud
 * @Package: com.superbytecode.cloud.rocketmq.consumer
 * @ClassName: RocketMQConsumeContainer
 * @Description: []
 * <p> </p>
 * @Author: [Lance Ting]
 * @Date: 2024/11/1 17:52
 * @Version: V1.0
 * @Copyright: 2024 www.super-master.com Inc. All rights reserved.
 * TODO: 注意,本文件Lance Ting所作,如果转载或使用请标明具体出处!
 **/
public interface MQConsumeProvider {

    /**
     * 注册容器
     *
     * @param targetClass 目标类
     * @param beanName    bean名称
     * @param beanObj     消费者的bean
     * @param topic       topic名字
     * @param group       消费组id
     * @param consumer    消费者配置
     */
    void register(Class<?> targetClass, String beanName, Object beanObj, String topic, String group, Consumer consumer);

    /**
     * 注册容器
     *
     * @param targetClass 目标类
     * @param beanName    bean名称
     * @param bean        消费者的bean
     * @param topic       topic名字
     * @param consumer    消费者配置
     */
    default void register(Class<?> targetClass, String beanName, Object bean, String topic, Consumer consumer) {
        String group = SpringContextUtil.getSpringValue(consumer.group());
        register(targetClass, beanName, bean, topic, group, consumer);
    }

    /**
     * QM服务提供者
     *
     * @return 阿里MQ|开源MQ
     */

    MQProviderEnum provider();
}